package com.example.geange.demo01;

import android.app.Fragment;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.SimpleAdapter;


import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;


public class Weather extends Fragment {

    public static List<Map<String, Object>> list = new ArrayList<>();
    public static SimpleAdapter simpleAdapter;
    private ListView listView;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_weather, container, false);
        listView = (ListView) view.findViewById(R.id.weather_list);
        simpleAdapter = new SimpleAdapter(getActivity(), list, R.layout.weather_line,
                        new String[]{"pic", "address", "temperature", "weather"},
                        new int[]{R.id.image_weather, R.id.location_text, R.id.temperature_text, R.id.weather_text});
        listView.setAdapter(simpleAdapter);
        return view;

    }


}
